import dayjs from 'dayjs'
export const jwt = (token: string) => {
  if (!token) return {}
  const { name, user_id, timestamp } = JSON.parse(atob(token.split('.')[1]))
  const isValid = dayjs().isBefore(dayjs(timestamp).add(1, 'days'))
  return { name, user_id, timestamp, isValid }
}
